<?php
/**
 * Albireo Kernel
 *
 * @copyright  Copyright (c) 2010 Albireo Solutions
 * @package    Kernel
 */
namespace Celebrio\Util;

use Nette\Object;

/**
 * UrlBuilder should simplify creating URLs with more parameters.
 * Some methods may be tailored for Google API.
 *
 * @author pavel
 *
 * @deprecated use \Nette\Web\Uri instead
 */
class UrlBuilder extends Object {
    
    private $baseUrl;
    private $args = array();

    public function __construct($baseUrl) {
        $this->baseUrl = $baseUrl;
    }
    
    public function addParameter($paramName, $paramValue) {
        $this->args[$paramName] = $paramValue;
    }
    
    /**
     * Builds and returns the URL represented by this UrlBuilder
     * 
     * @return String whole URL
     */
    public function build() {
        $scopeParams = \http_build_query($this->args);
        return $this->baseUrl . "?" .$scopeParams;
    }

    public static function build_url($baseUrl, array $params) {
        $scopeParams = \http_build_query($params);
        return $baseUrl . "?" .$scopeParams;
    }
}
